<template >
  <div class="container">
    <!-- 头像昵称 -->
    <div class="user">
      <van-image
        width="100"
        height="100"
        :src="userInfo.avatar"
        class="img"
      />
      <div class="text">{{ userInfo.name }}</div>
    </div>
    <!-- 快捷入口 -->
    <div class="order">
      <div class="top">
        <span class="text1">我的订单</span>
        <span class="text2" @click="router.push('/order')">全部</span>
      </div>
      <van-row class="bottom">
        <van-col span="6" class="item" style="text-align: center;">
          <van-image width="40" height="40" src="../../../public/images/ods_10.png"/>
          <div>待支付</div>
        </van-col>
        <van-col span="6" class="item" style="text-align: center;">
          <van-image width="40" height="40" src="../../../public/images/ods_20.png"/>
          <div>待服务</div>
        </van-col>
        <van-col span="6" class="item" style="text-align: center;">
          <van-image width="40" height="40" src="../../../public/images/ods_30.png"/>
          <div>已完成</div>
        </van-col>
        <van-col span="6" class="item" style="text-align: center;">
          <van-image width="40" height="40" src="../../../public/images/ods_40.png"/>
          <div>已取消</div>
        </van-col>
      </van-row>
    </div>
    <!-- 底部 -->
    <div class="foot">
      <div class="foot1">
        <span>
          <van-image
            width="20"
            height="20"
            src="../../../public/images/ic_clients.png"
          />
          服务对象管理
        </span>
        <van-icon name="arrow" style="line-height: 50px;"/>
      </div>
      <div class="foot2">
        <span>
          <van-image
             width="20"
             height="20"
             src="../../../public/images/ic_share.png"
           />
          分享转发
        </span>
        <van-icon name="arrow" style="line-height: 50px;"/>
      </div>
    </div>
    <!-- 推出登录按钮 -->
    <van-button type="danger" class="quit-text quit" @click="show=true">退出登录</van-button>
  </div>
  <!-- 退出登录弹窗 -->
  <van-dialog 
    v-model:show="show" 
    title="提示" 
    show-cancel-button
    @cancle="cancleOut"
    @confirm="confirmOut">
    <template #default>
       <div style="height: 70px;line-height: 70px; text-align: center;">是否确认退出登录</div>
    </template>
  </van-dialog>
</template>

<script setup>
import {useRouter} from 'vue-router'
import { ref} from 'vue';
const router=useRouter()
const userInfo=JSON.parse(localStorage.getItem('pz_userInfo'))
const show=ref(false)
const confirmOut=()=>{
  localStorage.removeItem('pz_token')
  localStorage.removeItem('pz_userInfo')
    showNotify('登出成功！');
  router.push('/login')
}
const cancleOut=()=>{
  show.value=false
}
</script>

<style lang="less" scoped>
  .container {
    background-color: #f0f0f0;
    height: 100vh;
    overflow: hidden;
    .user {
      width: 95%;
      height: 200px;
      background-color: #fff;
      text-align: center;
      border-radius: 10px;
      margin: 10px;
      .img {
        margin-top: 30px;
      }
      .text {
        line-height: 30px;
        font-weight: bold;
      }
    }
    .order {
      width: 90%;
      margin: 10px;
      border-radius: 5px;
      background-color: #fff;
      padding: 10px;
      .top {
        margin: 10px;
        line-height: 50px;
        display: flex;
        justify-content: space-between;
        .text1 {
          color: #333;
        }
        .text2 {
          color: #999;
        }
        border-bottom: 0.5px solid #f5f5f5;
      }
      .buttom {
        padding: 10px;
        display: flex;
        justify-content: space-around;
        .item {
          font-size: 14px;
          color: #999;
        }
      }
    }
    .foot {
      margin: 0 10px;
      padding: 10px;
      line-height: 50px;
      background-color: #fff;
      .foot1,
      .foot2 {
        display: flex;
        justify-content: space-between;
        color: #555;
      }
      .foot1 {
        border-bottom: 0.5px solid #f5f5f5;
      }
    }
    .quit {
      width: 90%;
      margin: 20px;
    }
    .quit_text {
      margin: 20px 0;
      text-align: center;
    }
  }
</style>